找传奇、传世资源到传世资源站!

读股票数据画K线图很不错的Delphi源码

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

读股票数据画K线图很不错的Delphi源码

procedure TfrmMain2.DrawScaleK(C: TCanvas; R: TRect);
var
    High, Low, D: Single;
  HIndex, LIndex: TArrayOfInteger;
  HA, LA: TArrayOfSingle;
begin
    if FindKLineScaleHighLow(StkDataFile,High,Low,HA,LA,HIndex,LIndex) then
  begin
      ScaleHigh[1] := High;
    ScaleLow[1] := Low;
      D := (High-Low) / 20;
    High:= High D;
    Low := Low -D;
        InflateRect(R,0,-2);
    DRAW_SCALE(C,R,ScaleLow[1],ScaleHigh[1],Low,High,_height_(R) div 25, True);
  end;
end;

procedure TfrmMain2.DrawV(C: TCanvas; R: TRect);
var
    D, High, Low: Single;
    I, J, X1, X2, Y1, Y2: Integer;
  P: PStkDataRec;
begin
    if FindVLineScaleHighLow(StkDataFile,High,Low) then
  begin
      ScaleHigh[2] := High;
    ScaleLow[2] := Low;
      D := (High-Low) / 10;
    High:= High D;
        InflateRect(R,0,-2);
    if ShowBackgroundDotLine then DRAW_HORZ_SCALE(C,R,ScaleLow[2],ScaleHigh[2],Low,High,_height_(R) div 25, True);
      _setPen_(C,GRID.Color,1,psSolid,pmCopy);
      _setBrush_(C,GRID.Color,bsSolid);
    for I := 0 to DataPerPage-1 do
    begin
      J := PageStart DataPerPage - I - 1;
      P := StkDataFile.getData(J);
      if P <> nil then
      begin
              if P^.CP > P^.OP then C.Pen.Color := clRed
        else     if P^.CP < P^.OP then C.Pen.Color := clAqua
        else                                                 C.Pen.Color := clLime;
        C.Brush.Color := C.Pen.Color;
        X1 := 1 UnitWidth * I;
        X2 := UnitWidth * (I 1);
        Y1 := R.Bottom;
        Y2 := Fy2Iy(P^.VOL,R,High,Low);
        if UnitWidth > 2 then C.Rectangle(Rect(X1,Y1,X2,Y2))
        else                             _line_(C,X1,Y1,X1,Y2);
      end;
    end;

    if IS_DRAW_MA then
        for I := 0 to Length(VMAC)-1 do
          if VMAC[I] > 0 then
            DrawLine(VMA[I], DEF_COLOR[I], C, R, High, Low);
  end;
end;

procedure TfrmMain2.DrawRSI(C: TCanvas; R: TRect);
var
    High, Low: Single;
  I, Y: Integer;
begin
    High := 100;
  Low := 0;
  ScaleHigh[3] := 100;
  ScaleLow[3] := 0;
    InflateRect(R,0,-2);
  _setBrush_(C,GRID.Color,bsSolid);
  if ShowBackgroundDotLine then
  begin
    _setPen_(C,clRed,1,psDot,pmCopy);
    Y := Fy2Iy(80,R,High,Low);    _line_(C,R.Left 1,Y,R.Right,Y,clRed);
    Y := Fy2Iy(50,R,High,Low);  _line_(C,R.Left 1,Y,R.Right,Y,clSilver);
    Y := Fy2Iy(20,R,High,Low);  _line_(C,R.Left 1,Y,R.Right,Y,clAqua);
  end;
  _setPen_(C,clRed,1,psSolid,pmCopy);

  for I := 0 to Length(RSIC)-1 do
    if RSIC[I] > 0 then
      DrawLine(RSI[I], DEF_COLOR[I], C, R, High, Low);

end;

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复